package sg.edu.nus.iss.jass.util;

import java.awt.Font;
import java.io.FileInputStream;
import java.util.Properties;

import javax.swing.JLabel;
import javax.swing.JTextArea;
import javax.swing.JTextField;

/**
 * @version 1.0
 * @author SE19 Team 1
 * 
 */
public class GUIUtils {

	public static JLabel createLabel(String label) {
		JLabel jlabel = new JLabel(label);
		jlabel.setFont(new Font("Calibri", Font.BOLD, 16));
		jlabel.setHorizontalAlignment(JLabel.RIGHT);
		jlabel.setVerticalAlignment(JLabel.TOP);

		return jlabel;
	}

	public static JTextField createTextField() {
		JTextField textfield = new JTextField(40);
		textfield.setFont(new Font("Calibri", Font.PLAIN, 16));
		return textfield;
	}
	
	public static JTextArea createTextArea() {
		JTextArea textArea=new JTextArea(5, 40);
		textArea.setFont(new Font("Calibri", Font.PLAIN, 16));
		return textArea;
	}
	
	public static Properties loadConfiguration() throws Exception {
		try {
			Properties properties = new Properties();
			FileInputStream in = new FileInputStream("properties/application.properties");
			properties.load(in);
			in.close();
			return properties;
		}
		catch(Exception ex) {
			ex.printStackTrace();
			throw ex;
		}
	}
}
